package main

import (
	"Head-first-go/chapter08/example1/calendar"
	"fmt"
	"log"
)

func main() {
	event := calendar.Event{}
	setyear, err := event.SetYear(2021)
	if err != nil {
		log.Fatal(err)
	}
	year := setyear.Year()
	fmt.Println(*setyear)
	fmt.Println(year)

	setmonth, err := event.SetMonth(12)
	if err != nil {
		log.Fatal(err)
	}
	month := setmonth.Month()
	fmt.Println(*setmonth)
	fmt.Println(month)

	setday, err := event.SetDay(31)
	if err != nil {
		log.Fatal(err)
	}
	day := setday.Day()
	fmt.Println(*setday)
	fmt.Println(day)

	fmt.Println(event.Date.Year())
	fmt.Println(event.Date.Month())
	fmt.Println(event.Date.Day())

	errorTitle := event.SetTitle("This is a very long title")
	if errorTitle != nil {
		log.Fatal(errorTitle)
	}
	fmt.Println(event.Title())
	// data2 := calendar.Date{
	// 	Year:  -1,
	// 	Month: 13,
	// 	Day:   34,
	// }
	// fmt.Println(data2)

	fmt.Printf("year:%d moth:%d day:%d\n", event.Year(), event.Month(), event.Day())
}
